<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>
<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >  
<script type="text/javascript">
    $(function(){
        window.alert = Boxy.alert;
    });
</script>
<div class="admin_nrtop">
    <div class="ad_search" style="font-size: 24px;">
    分类:<?php echo Application_Model_Goodsmenu::getmenuname($this->menuid);?>    
    <form method="get" style="display: inline;padding-left: 50px;">
         <input type="text" id="keywords" name="keywords" value="<?php echo $this->keywords;?>"/>
         <button id="getinfo" type="submit">搜索商品</button>
    </form>
     </div>
</div>
<style>
.add_div{width: 1200px;    overflow: hidden;    margin-bottom: 80px;}
.add_div li{float: left;width: 268px;height:338px;margin:20px 10px;padding:5px;list-style: none;border: 1px solid #fff;}
.add_div li.active{border-color: #f00;}
.add_div li img{width: 100%;height:268px; }
.add_div .goods-name{}
.add_div .goods-price{color: red;}
.add_div .goods-price del{float: right;color: #999;}
.toolbar{position: fixed;bottom: 0;    width: 100%;background: #fff;}
</style>
<div  class="biaoge">
    <div class="add_div">

       <?php  if($this->goods) { foreach ($this->goods as $key=>$Item) { ?> 
        <li><input type="hidden" name="goodsid[]" value="<?php echo $key;?>"><img src="<?php echo $Item['pict_url'];?>"><p class="goods-name"><a href="<?php echo $Item['item_url'];?>" target="_blank"> <?php echo $Item['title'];?></a></p><p class="goods-price">￥<?php echo $Item['zk_final_price'];?><del><?php echo $Item['reserve_price'];?></del></p></li>
       <?php } }?>  
    </div>
 </div>
 <div class="toolbar">
  <div class="qunx">
        <ul>
            <li><a class="anvbotton" href="javascript:void(0)"  name="addGeneralize"><span>添加商品</span></a></li>
        </ul>
    </div>
   </div>  
<script>
    $(function(){  
       
        $('.add_div li').click(function(){           
        if($(this).attr('class')=='active'){
           $(this).removeClass('active');
        }else{
            $(this).addClass('active');
        }           
        });       
        
        $(".anvbotton").click(function(){
            var goodsAll = "";
            $.each($(".add_div li.active input[name='goodsid[]']"), function(i,val){ 
            if(val.value == ""){
                alert("排序值不能为空");
                isOrder = true;
                return ;
            }
            goodsAll += val.value+",";   
             });
         $.post("/admini/goods/addgoods",{"goodsAll":goodsAll,"menuid":<?php echo $this->menuid;?>},function(date){
            if(date == 1){
                 alert("添加成功");
                 history.go(-2);
            }else{               
                alert("出现未知错误，请刷新在试。");
            }
        },'json');
        }); 
    });
</script>